package cn.kgm.article.api;

import cn.kgm.article.dto.dto.ArticleInfoSaveDTO;
import cn.kgm.article.dto.dto.ArticleInfoUpdateDTO;
import cn.kgm.article.dto.query.ArticleInfoPageQuery;
import cn.kgm.article.dto.vo.ArticleInfoVO;
import cn.kgm.core.http.response.R;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * # 技术改变自己 #
 * @author kapi
 * @email yolo.jk@qq.com
 * @date 2024-03-15 14:38:00
 */
@FeignClient(name = "kapi-article-server")
public interface ArticleInfoControllerApi{

    /**
     * 分页列表查询文章详情
     */
    @ApiOperation(value = "分页查询", notes = "分页查询文章详情")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNo", value = "页码", dataType = "long", paramType = "query", defaultValue = "1"),
            @ApiImplicitParam(name = "pageSize", value = "分页条数", dataType = "long", paramType = "query", defaultValue = "10"),
    })
    @GetMapping(value = "/articleInfo/page")
    R<IPage<ArticleInfoVO>> page(ArticleInfoPageQuery data);

    /**
     * 根据id查询文章详情详情
     */
    @ApiOperation(value = "查看详情", notes = "根据id查询文章详情详情")
    @GetMapping(value = "/articleInfo/{id}")
    R<ArticleInfoVO> get(@PathVariable(value = "id") Long id);

    /**
     * 新增文章详情
     */
    @ApiOperation(value = "新增", notes = "新增文章详情")
    @PostMapping("/articleInfo/save")
    R<Boolean> save(@RequestBody @Validated ArticleInfoSaveDTO data);

    /**
     * 修改文章详情
     */
    @ApiOperation(value = "修改", notes = "修改文章详情")
    @PostMapping("/articleInfo/update")
    R<Boolean> update(@RequestBody @Validated ArticleInfoUpdateDTO data);

    /**
     * 根据id更新文章详情的删除状态
     */
    @ApiOperation(value = "删除", notes = "根据id更新文章详情的删除状态")
    @GetMapping(value = "/articleInfo/delete/{ids}")
    R<Boolean> delete(@PathVariable(value = "id") Long[] ids);
}

